using System; 
using System.Threading; 
using System.Workflow.Activities; 
using System.Workflow.Runtime; 
 
namespace FooBar 
{
   class Hello 
   { 
      public static void Main()
      {
         using (WorkflowRuntime workflowRuntime = new WorkflowRuntime()) 
         {
            AutoResetEvent waitHandle = new AutoResetEvent(false);
 
            workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e) 
            { 
               waitHandle.Set();
            }; 
 
            WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(FooBar.Demo)); 
            instance.Start(); 
            waitHandle.WaitOne(); 
         }
      }
   }
   partial class Demo
   {
		tweetClass tweet= new tweetClass(); 

 
		private void tuitar0_ExecuteCode(object sender, EventArgs e) { 
			tweet.tweet("tuitando no twitter com o twitterPEWS"); 
		}
		private void tuitar1_ExecuteCode(object sender, EventArgs e) { 
			tweet.tweet("Versão Trial acabou, compre a versão FULL no site www.tuiterpews.com.br"); 
		}
		private void IfElseCondition0_ExecuteCode(object sender, ConditionalEventArgs e) 
 		{ 
 			if (tweet.termval <= 5) 
				e.Result = true; 
			else 
				e.Result = false; 
		}
		private void IfElseCondition1_ExecuteCode(object sender, ConditionalEventArgs e) 
 		{ 
 			if (tweet.termval > 5) 
				e.Result = true; 
			else 
				e.Result = false; 
		}
		private void WhileActivity0_CodeCondition(object sender, ConditionalEventArgs e)
		{
			if (10 == 10)
				e.Result = true;
			else 
			{
				e.Result = false; 
				Console.Read();
			}
		}

		private void finalizar_ExecuteCode(object sender, EventArgs e) { 
			Console.WriteLine("Tecle Enter para sair: "); 
  			Console.ReadLine();
		}
	}
}